## -------------------------------------------------- #
## ReuningDietrich_PoP_README.txt
## -------------------------------------------------- #

 Date: 2018-06-21

 Authors: Kevin Reuning and Nick Dietrich

 Title: Media Coverage, Public Interest, and Support in the 2016 Republican Invisible Primary

 Contact Information: 
   Kevin Reuning <kevin.reuning@gmail.com>

 Copyright (c) 2018, under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
 For more information see: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
 All rights reserved. 


## -------------------------------------------------- #
## install R and necessary packages for analysis
## -------------------------------------------------- #

open the .R file using any text or source code editor such as:
	TextEdit, emacs, Aquamacs, notepad++ , or Xpad

set the working directory to the folder containing the data files 

the set working directory command in R is setwd()
	type ?setwd for help documentation 

to set the path type into R: 

setwd("PATH_NAME")

where PATH_NAME is the path to the folder with the data

install packages if necessary:
	packages <- c("coda","RColorBrewer", "LSTS","devtools")
	install.packages(packages)
	install.packages("KRMSBVAR_0.1.tar.gz") ## Note this uses an altered version of MSBVAR


You should place the folders that contain this file and the additional folders it contains into the R working directory. 

The R working directory is available via the getwd() function in R.

The attached code makes use of the file structure. As long as the folders are in the R working directory the script will find these files and work properly. 

The last version of R and Mac OS-X are:

	R version 3.5.0 (2018-04-23) -- "Joy in Playing"
	Copyright (C) 2018 The R Foundation for Statistical Computing
	Platform: x86_64-apple-darwin15.6.0 (64-bit)

	

# ---------------------------------------------------------------------------------------------------- #
# file folder descriptions
# ---------------------------------------------------------------------------------------------------- #

Descriptive Plots.R - Creates Figure 2a and Figure 2b
PoP_Scripts.R - Estimates all models and exports Figures 3, 4 and 5. NOTE: It uses our own version of MSBVAR (KRMSBVAR) which is also included and can be installed with install.packages("MSBVAR_0.9-2.tar.gz")
Time_Series-Original.RData - Contains all the data used in the scripts. 
KRMSBVAR_0.1.tar.gz - An edited version of Patrick Brandt's MSBVAR package that creates scaled IRFs. Install it with install.packages("KRMSBVAR_0.1.tar.gz")
Appendix.zip - Contains similar code and data to estimate the models presented in the appendix. 
